/**
 * Created by henian.xu on 2018/10/9.
 *
 */

import './assets/style/app.scss';
import Router from './router';
import Store from './store';
import Api, { HttpCommBase } from './api';

import ElementUi from 'element-ui';
import components from './components';
import BaiduMap from 'vue-baidu-map';
import DefaultImg from './assets/images/default.jpg';
import * as Utils from 'vue-cpf/utils';
import filter from './filter';
import directives from './directives';

export default {
    install(Vue, { router, store, apiBase, GlobalVar, Config } = {}) {
        // 注入
        Vue.prototype.$defaultImg = DefaultImg;
        Vue.prototype.$globalVar = GlobalVar;
        Vue.prototype.$config = Config;
        Vue.prototype.$http = apiBase.HttpInstance;
        Vue.prototype.$utils = Utils;

        Vue.use(Router, { router, store, GlobalVar });
        Vue.use(Store, { store });
        Vue.use(Api, { apiBase, router, GlobalVar });

        Vue.use(filter);
        Vue.use(directives, { router, store });
        Vue.use(ElementUi);
        Vue.use(components);
        Vue.use(BaiduMap, { ak: GlobalVar.mapKey.baiduAK });
    },
};

export { ElementUi, Utils, HttpCommBase };
